#include "common.h"
#include <pthread.h>

void *sort(void *arg)
{
	//sleep(atoi((char *)arg));
	//printf("ok\n");
	printf("%s\n", (char *)arg);

	return NULL;
}

int main(int argc, char *argv[])
{
	if(argc <= 1)
		err_sys("argument error\n");

	//pthread_t tid;
	int i;
	//pthread_t i;
	int ret = 0;

	for(i = 1; i < argc; i++)
	{
		pthread_t tid;
		sleep(atoi(argv[i]));
		ret = pthread_create(&tid, NULL, sort, (void *)argv[i]);
		if(ret != 0)
			err_sys("pthread_create error\n");

		pthread_join(tid, NULL);
	}

	return 0;
}
